<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="../../css/layui.css" media="all">
		<link rel="stylesheet" href="../../css/formSelects-v4.css" />
		<script src="../../js/jquery.min.js"></script>
		<script src="../../layui.all.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/formSelects-v4.js" type="text/javascript" charset="utf-8"></script>
		
	</head>
	<body>
		<select name="city" xm-select="select1">
		    <option value="1" disabled="disabled">北京</option>
		    <option value="2" selected="selected">上海</option>
		    <option value="3">广州</option>
		    <option value="4" selected="selected">深圳</option>
		    <option value="5">天津</option>
		</select>
		
		<select name="city" xm-select="select15">
        	<option value="">请选择, 此处是联动多选</option>
    	</select>
	<script src="../../UI/layui-v2.3.0-rc1/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../dist/formSelects-v4.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
        layui.use('formSelects', function(){
        	var formSelects = layui.formSelects;
        }); 
        formSelects.data('select15', 'local', {
		    arr: [
		        {
		        	"name": "北京", 
		        	"value": 1, 
		        	"children": [
						{"name": "北京市1", "value": 12, "children": [
							{"name": "朝阳区1", "value": 13, "children": []},
							{"name": "朝阳区2", "value": 14, "children": []},
							{"name": "朝阳区3", "value": 15, "children": []},
							{"name": "朝阳区4", "value": 16, "children": []},
						]},
						{"name": "北京市2", "value": 17, "children": []},
						{"name": "北京市3", "value": 18, "children": []},
						{"name": "北京市4", "value": 19, "children": []},
		        	]
				},
				{
		        	"name": "天津", 
		        	"value": 2, 
		        	"children": [
						{"name": "天津市1", "value": 51, "children": []},
		        	]
				},
		    ],
		    linkage: true
		});
		
		formSelects.config({
			success: function(id, url, val, result){
				console.log("success回调: " + url, id);
			},
			error: function(id, url, val, err){
				console.log("err回调: " + url, id);
			}
		});
        
	</script>
	</body>  

</html>